package com.uzai.console.web.contract;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.uzai.console.dto.contract.ContractSignDto;
import com.uzai.console.dto.contract.ContractSignPageVo;
import com.uzai.console.dto.contract.ContractSignQuery;
import com.uzai.console.dto.takebal.usertakebal.UserTakeBalQuery;
import com.uzai.console.jsonvo.contract.ContractSignAddressJson;
import com.uzai.console.service.contract.SysContractService;
import com.uzai.console.vo.base.SelectKeyVo;
import com.uzai.console.vo.contract.ContractAddressVo;
import com.uzai.console.vo.contract.ContractDownLoadInfoVo;
import com.uzai.console.vo.contract.ContractSignInfoVo;
import com.uzai.console.vo.contract.ContractStatusVo;
import com.uzai.console.vo.login.LoginVo;
import com.uzai.console.vo.takebal.usertakebal.UserTakeBalPageVo;
import com.uzai.console.web.BaseController;
import com.uzai.console.web.device.DeviceController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "合同管理",tags = "系统设置|账号设置")
@RestController
public class SysContractController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(SysContractController.class);

    @Autowired
    private SysContractService sysContractService;

    @ApiOperation(value = "查询合同签约状态", notes = "查询合同签约状态", response = ContractStatusVo.class)
    @ApiOperationSupport(order = 1)
    @PostMapping("/contract/getContractSignStatus")
    public Object getContractSignStatus(){
        LoginVo loginInfo = getLoginInfo();
        return sysContractService.getContractSignStatus(loginInfo);
    }

    @ApiOperation(value = "获取合同下载地址", notes = "获取合同下载地址", response = ContractDownLoadInfoVo.class)
    @ApiOperationSupport(order = 2)
    @PostMapping("/contract/getContractDownLoadUrl")
    public Object getContractDownLoadUrl(@RequestBody ContractSignDto contractSignDto){

        return sysContractService.getContractDownLoadUrl(contractSignDto);
    }

    @ApiOperation(value = "查看合同", notes = "查看合同", response = ContractSignAddressJson.class)
    @ApiOperationSupport(order = 3)
    @PostMapping("/contract/getContractSignInfo")
    public Object getContractSignInfo(@RequestBody ContractSignDto contractSignDto){

        return sysContractService.getContractSignInfo(contractSignDto);
    }

    @ApiOperation(value = "分页查询合同列表", notes = "分页查询合同列表", response = ContractSignPageVo.class)
    @ApiOperationSupport(order = 4)
    @PostMapping("/contract/findContractSignBalList")
    public Object findContractSignBalList(@RequestBody ContractSignQuery contractSignQuery){
        return sysContractService.findContractSignBalList(contractSignQuery);
    }

}
